home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / tc_btree.zip / ACCESS.H next >
C/C++ Source or Header  |  1989-02-08  |  3KB  |  93 lines

  1. char *  getrec (datafile * dfp, int recno, char * buff);
  2.     /*
  3.      *  Get the recno record of the datafile *dfp and place the record
  4.      *  where buff points to. Getrec returns this same pointer value.
  5.      */
  6. int     putrec (datafile * dfp, int recno, char * buff);
  7.     /*
  8.      *  Write the record pointed to by buff as record number recno
  9.      *  to the datafile *dfp. Return the value 1 is successful.
  10.      */
  11. datafile *  makefile (char * fname, int recsize);
  12.     /*
  13.      *  Make a file, fname, to have record size equal to recsize.
  14.      */
  15. datafile *  openfile (char *);
  16. void    closefile (datafile *);
  17. int     newrec (datafile * dfp);
  18.     /*
  19.      *  Get a new record. Return the record number of this new record.
  20.      */
  21. int     addrec (datafile * dfp, char * buff);
  22.     /*
  23.      *  Add the data pointed to by buff as a new record to the
  24.      *  datafile * dfp. Return the record number of this new record.
  25.      */
  26. void    deleterec (datafile * dfp, int recno);
  27.     /*
  28.      *  delete the data item with record number recno from the
  29.      *  datafile *dfp.
  30.      */
  31. int     usedrecs (datafile * dfp);
  32.     /*
  33.      *  Return the number of active record of the datafile * dfp.
  34.      */
  35. void    initindex (void);
  36.     /*
  37.      *  initialize the stack for the index pages.
  38.      */
  39. void    tapack (tapagerec * ppagrec);
  40. void    taunpack (tapagerec * ppagrec);
  41.     /*
  42.      *  When writing a page to disk, we do a little packing to conserve
  43.      *  disk space.  Conversely, we must do a little unpacking when we
  44.      *  an index page from disk.
  45.      */
  46. indexfile *  makeindex (char * fname, int keylength, int dupsallowed);
  47.     /*
  48.      *  Make an indexfile named fname with key length keylength and
  49.      *  duplicates will be allowed if dupsallowed is not zero.
  50.      *  Return a pointer to the indexfile if successful, else NULL.
  51.      */
  52. indexfile *  openindex (char * fname);
  53. void    closeindex (indexfile * fname);
  54. void    talast (int i);
  55.     /*
  56.      *  talast makes the ith page on the pagerec stack the most
  57.      *  recently accessed page.
  58.      */
  59.  
  60. tapagerec *  tagetpage (indexfile * dfp, int pageref);
  61.     /*
  62.      *  Read a page from disk, if necessary, to the page stack. The record
  63.      *  number of the page is pageref associated with the indexfile * dfp.
  64.      *  Return a pointer to where the page is on the stack.
  65.      */
  66. tapagerec *  tanewpage (indexfile * nfp);
  67.     /*
  68.      *  Find space on the page stack and initialize a new page to be
  69.      *  associated with the indexfile *nfp.  Return a pointer to where
  70.      *  the page is on the stack.
  71.      */
  72. void    tareturnpage (tapage * pageptr);
  73.     /*
  74.      *  delete the page pointed by the page pointer pageptr.
  75.      */
  76. void    taxkey (char * key, int keylen);
  77.     /*
  78.      *  Chop off the key if it is longer than keylen.
  79.      */
  80. int     tacompkeys (char * key1, char * key2,
  81.                     int datref1, int datref2, int dupsallowed);
  82.     /*
  83.      *  Compare two keys. Return the strcmp() value if not equal.
  84.      *  If equal then
  85.      *      if dups are allowed
  86.      *          return datref1 - datref2
  87.      *      Otherwise
  88.      *          return 0.
  89.      */
  90. void    clearkey (indexfile * nfp);
  91.     /*
  92.      *  initialize the search path to no current path for the indexfile *nfp.
  93.      */